package com.yang.train.batch.controller;

import com.yang.train.batch.feign.BusinessFeign;
import com.yang.train.common.resp.CommonResp;
import jakarta.annotation.Resource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Date;

/**
 * @author 缘友一世
 * date 2024-02-14-15:37
 */
@RestController
public class TestController {
    private static final Logger LOG = LoggerFactory.getLogger(TestController.class);

    @Resource
    BusinessFeign businessFeign;

    @GetMapping("/hello")
    public String hello() {
        String businessHello = businessFeign.hello();
        LOG.info(businessHello);
        return "Hello World! Batch! " + businessHello;
    }
    @GetMapping("/gen")
    public String genData(Date date) {
        CommonResp<Object> resp = businessFeign.genDaily(date);
        LOG.info(String.valueOf(resp));
        return "Hello World! Batch! " + resp;
    }
}